package Reflect;

import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;

public class TestDemo02 {

    public static void main(String[] args) {

    }
    public  static  void getDeclaredConstructor() throws Exception {
        Class c =Student.class;
        //按照参数定位无参数构造器
        Field[] fields=c.getDeclaredFields();
        for (Field field : fields) {
            System.out.println(field.getName()+"=====>"+field.getType());
        }
    }

    public static void getDeclareMethods(){
        Class c =Student.class;
        Method[] declaredMethods = c.getDeclaredMethods();
        for (Method declaredMethod : declaredMethods) {
            System.out.println(declaredMethod.getName()+" "+declaredMethod.getParameterCount());
        }
    }

}
